SELECT TOP (5)
ProductID,
EndDate,
DATEPART(YEAR, EndDate) AS [Year],
DATEPART(MONTH, EndDate) AS [Month],
DATEPART(DAY, EndDate) AS [Day]
FROM Production.ProductCostHistory
WHERE EndDate IS NOT NULL;